package ebj.common.jetty;

import java.io.File;

import org.apache.log4j.Logger;
import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.nio.SelectChannelConnector;
import org.mortbay.jetty.webapp.WebAppContext;


public class JettyMain {
	private static Logger logger = Logger.getLogger(JettyMain.class);
	
	public static void main(String[] args) {
		String proAbsPath = new File("").getAbsolutePath();
		/*
		 * D:\MyWorkSpace\Jee\jse_common\src\main\java\ebj\common\jetty
		 * D:\MyWorkSpace\Jee\jse_common
		 */
		System.out.println(proAbsPath);
		String subPath = "\\WebRoot";
		
		Connector connector = new SelectChannelConnector();
		connector.setPort(8090);
		Server server = new Server();
		server.setConnectors(new Connector[]{connector});
		
		WebAppContext webAppContext = new WebAppContext(server, proAbsPath + subPath, "/my");
		try {
			server.start();
		} catch (Exception e) {
			logger.error("error", e);
		}
		
//		try {
//			server.stop();
//		} catch (Exception e) {
//			e.printStackTrace();
//		}
	}
}
